﻿using System;
using System.Collections.Generic;
using Petra.Gis.Imaging.Tiff;


namespace Petra.Gis.Geometry.Image
{
  public class SpatialReferencedImageData
  {
    object _decoder;
    List<Overview> _frames = new List<Overview>();

    public SpatialReferencedImageData(string fileName)
    {

      string fileExtension = fileName.Substring(fileName.Length - 4);

      switch (fileExtension.ToLower())
      {
        case "tif":
        case "tiff":
          _decoder = new Decoder(fileName);
          foreach (TiffBitmapPage p in ((Decoder)_decoder).Frames)
            _frames.Add(new Overview(p));

          break;
        default:
          throw new NotImplementedException();
      }
    }


    public List<Overview> Overviews
    {
      get { return _frames; }
    }




      public bool IsImageWithOverviews
      {

        //todo: perform more tests to determine....
        get
        {
          if(_frames.Count > 1)
            return true;
          else 
            return false;
        }
      }







  }
}
